// Set utils function parseTime to filter
import {isBlank} from "@/core/utils/Utils";

export {parseTime} from '@/core/utils'

// Filter for article status
export const articleStatusFilter = (status: string) => {
    const statusMap: { [key: string]: string } = {
        published: 'success',
        draft: 'info',
        deleted: 'danger'
    };
    return statusMap[status]
};

// Filter to uppercase the first character
export const uppercaseFirstChar = (str: string) => {
    return str.charAt(0).toUpperCase() + str.slice(1)
};


//分类级别
export const typeLevel = (str: any) => {
    switch (str) {
        case "0":
            return '一级分类';
        default:
            return "二级分类";
    }
};

export const nullFilter = (str: any) => {
    if (isBlank(str)) return "暂无数据";
    if (str == 0) return 0;
    return str ? str : "暂无数据";
};


export const subStr = (str: any, sub: number) => {
    // let number = 5 + (-3);
    // alert(number)
    if (str) {
        let count = str.length + sub;
        return str.substring(0, count)
    }
    return "暂无数据";
};


//公司内容过滤器
export const companyContentFilter = (str: any) => {
    if (str) {
        if (str.length > 10) {
            return str.toString().top(10) + "..."
        }
        return str;
    }
    return "暂无数据";
};






